package com.zhanghp.industry;

import com.zhanghp.Army;
import com.zhanghp.Castle;
import com.zhanghp.King;
import com.zhanghp.factory.KingdomFactory;
import com.zhanghp.kind.elven.ElKingdomFactory;
import com.zhanghp.kind.orcish.OrcKingdomFactory;
import lombok.Data;

/**
 * @author zhanghp
 * @date 2022-08-05 16:33
 */
@Data
public class Kingdom {

    /**
     * 国王
     */
    private King king;

    /**
     * 武器
     */
    private Army army;

    /**
     * 城堡
     */
    private Castle castle;

    public static class FactoryMaker {

        /**
         * 种族
         */
        public enum KingdomType{
            /**
             * 精灵族
             */
            ELVEN,
            /**
             * 兽人族
             */
            ORCISH
        }

        /**
         * 根据王国类型，制造国家
         *
         * @param type 种族类型
         * @return 种族
         */
        public static KingdomFactory makeFartory(KingdomType type){
            KingdomFactory result;
            switch (type){
                case ELVEN:
                    result = new ElKingdomFactory();
                    break;
                case ORCISH:
                    result = new OrcKingdomFactory();
                    break;
                default:
                    throw new IllegalArgumentException("KingdomType not supported");
            }
            return result;
        }
    }
}
